package basic;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Reservation extends MainClass {

    private static int currId = 0;
    private static SimpleDateFormat datePat = new SimpleDateFormat("dd/MM/yyyy");
    private int clientId;
    private int bikeId;
    private Date hireDate;
    private Date returnDate;
    private int cost = 0;
    private ReservationStatus status;

    public Reservation() {
        this.id = ++currId;
    }
    
    public Reservation( int clientId, int bikeId, Date hireDate, Date returnDate, ReservationStatus status ){
        this.id=++currId;
        this.clientId = clientId;
        this.bikeId = bikeId;
        this.hireDate = hireDate;
        this.returnDate = returnDate;
        this.status = status;
    }

    public int getClientId() {
        return clientId;
    }

    public void setClientId(int clientId) {
        this.clientId = clientId;
    }

    public int getBikeId() {
        return bikeId;
    }

    public void setBikeId(int bikeId) {
        this.bikeId = bikeId;
    }

    public Date getHireDate() {
        return hireDate;
    }

    public void setHireDate(Date hireDate) {
        this.hireDate = hireDate;
    }

    public Date getReturnDate() {
        return returnDate;
    }

    public void setReturnDate(Date returnDate) {
        this.returnDate = returnDate;
    }

    public int getCost() {
        return cost;
    }

    public void setCost(int cost) {
        this.cost = cost;
    }

    public ReservationStatus getStatus() {
        return status;
    }

    public void setStatus(ReservationStatus status) {
        this.status = status;
    }
    
    
    @Override
    public String toString() {
        return String.format("%4d %10d %10d %12s %12s %15s %5d", this.getId(),
                this.getClientId(), this.getBikeId(), datePat.format(hireDate),
                datePat.format(returnDate), this.getStatus(), this.getCost() );
    }

}
